package gw.com.android.ui.system;

import android.content.Intent;

import com.gwtsz.gts2.hx.R;

import gw.com.android.app.AppContances;
import gw.com.android.ui.BaseActivity;
import gw.com.android.ui.news.NewsFragment;
import www.com.library.app.FragmentsManagerUtil;
import www.com.library.app.Logger;

/**
 * 我的收藏界面
 * 
 * @author reeta
 * 
 */
public class AppCollectActivity extends BaseActivity {

	private String mTitle;
	private String mBackTitle;

	private NewsFragment mFragment;

	@Override
	protected void setAcitivityParam() {
		if(null != getIntent()){
			mBackTitle = getIntent().getStringExtra("mBackTitle");
			mTitle = getIntent().getStringExtra("mTitle");
		}
	}

	@Override
	protected int getLayoutView() {
		return R.layout.activity_app_sys_list;
	}

	@Override
	protected void initLayoutView() {
		mTitleBar.setAppTitle(mTitle);
		//mTitleBar.setLeftResource(mBackTitle);
		showNewsFragment();
	}

	@Override
	protected void initViewData() {

	}

	/**
	 * 展示需要使用到单点登录界面的网页嵌套界面
	 */
	public void showNewsFragment() {
		mFragment = (NewsFragment) FragmentsManagerUtil.instance().getFragmentbyTag(AppCollectActivity.this, mCurrentTag);
		if (null == mFragment) {
			mFragment = NewsFragment.newInstance(AppContances.NEWS_TYPE_COLLECT+"", mTitle, "");
			FragmentsManagerUtil.instance().addPushMsgTabFragment(AppCollectActivity.this, mFragment, mCurrentTag);
		}
		showFragment(mFragment);
		mFragment.setEnablePull(false, false);
	}

	@Override
	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
		super.onActivityResult(requestCode, resultCode, data);
		if(null != mFragment){
			Logger.e("详情返回到收藏界面 onActivityResult");
			mFragment.onRefresh();
		}
	}
}
